#include<bits/stdc++.h>
using namespace std;
const int N=5001;
typedef long long LL;

int n;
int x[N],y[N];
double len(int s,int t)
{
    return sqrt(pow(x[s]-x[t],2)+pow(y[s]-y[t],2));
}
double ans=0;
//并查集
int fa[N];
int find(int x){
    if(x != fa[x]) fa[x] = find(fa[x]);
    return fa[x];
}
void merge(int a,int b){
    fa[find(a)] = find(b);
}


int main()
{
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d%d",&x[i],&y[i]);
        fa[i]=i;
    }
    int road=0;

    while(road<n-1){
        vector<vector<int>> vecs(n);
        for(int i=0;i<n;i++){
            int fa1=find(i);
            vecs[fa1].emplace_back(i);
        }
        int size=vecs.size();
        for(int i=0;i<n&&road<n-1;i++)
        {
            if(vecs[i].empty()) continue;
            double disi=1e9+0.0;
            int tj;
            for(int j=0;j<n&&road<n-1;j++)
            {
                if(i==j) continue;
                if(vecs[j].empty()) continue;
                //dis 表示i,j群里最小的距离
                double dis=0.0+1e9;
                for(auto num1:vecs[i]){
                    for(auto num2:vecs[j]){
                        double temp=len(num1,num2);
                        dis=min(temp,dis);
                    }
                }
                if(dis<disi){
                    disi=dis;
                    tj=j;
                }
            }
            if(find(i)==find(tj)) continue;
            //printf("%d  %d\n",i,tj);
            merge(i,tj);
            ans+=disi;
            road++;
        }
    }
    printf("%.2f",ans);
    return 0;
}